Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
There currently exists no mechanism for being able to change the number of hashes per tick.
Summary of Changes
DEFAULT_HASHES_PER_SECOND
)set_bank
when a newhashes_per_tick
value is detectedpoh_config
fromPohRecorder
Note 4 above is the key change that gets things working. With naive implementation, we see PoH continue building up tick entries with old ticks_per_slot, and once the bank with updated ticks_per_slot gets assigned, it sends these old entries associated with the new bank and Blockstore barfs. We need to kill these old tick entries and restart with updated
hashes_per_tick
Theory of Operation
PoH will derive appropriate hashes per tick from the associated bank for that slot (through the
reset
function which synchronizes bank and PoH). Banks will inherit hashes per tick from their parent (or load from snapshot) except in the special case where we activate the 'configurable hashes per tick' feature and force the child bank toDEFAULT_HASHES_PER_SECOND
on epoch boundary. Thus, changingDEFAULT_HASHES_PER_SECOND
should have no impact to what is actually happening on chain until the feature is activated. It will, of course, impact testing.Testing
Testing these changes is difficult as we need to coerce a hashes per tick change to agitate things. The following testing has been performed on top of the normal buildkite stuff:
poh_config.hashes_per_tick
to 500 (so that we will actually hash to tick), forceapply_updated_hashes_per_tick
to execute on every epoch boundary, and run local_cluster, poh, runtime, and core cargo tests. Note: through logging it was confirmed that we reset PoH from 500 to 12500 hashes per tick on epoch boundary and all entries sent to replay/other validators were aligned withbank.hashes_per_tick
test_feature_activation_idempotent
ensures repeated calls toapply_feature_activations
will not cause issuesDEFAULT_HASHES_PER_SECOND
unchanged)DEFAULT_HASHES_PER_SECOND
increased)